package gob.inei.enaho.controller.activity;

import gob.inei.enaho.context.AppContext;
import gob.inei.enaho2014.R;
import util.android.ViewUtil;
import util.android.AndroidUtil;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;

public class LoginActivity extends ActionBarActivity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.login);

		//TEMPORAL
		aceptar();
		
		ViewUtil.onClick(this,R.id.btnAceptar,new View.OnClickListener() {			
			@Override
			public void onClick(View v) {
				aceptar();
			}
		});
		
		ViewUtil.onClick(this,R.id.btnCancelar,new View.OnClickListener() {			
			@Override
			public void onClick(View v) {
				finish();
			}
		});
		
		TextView tv = (TextView) this.findViewById(R.id.txtEnaho);
		tv.setText(tv.getText()+" "+AppContext.ANHO_ENCUESTA);
		
	}
	
	private void aceptar() {
		AndroidUtil.abrirActivity(LoginActivity.this, HomeActivity.class);
	}
	
	

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.home, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Handle action bar item clicks here. The action bar will
		// automatically handle clicks on the Home/Up button, so long
		// as you specify a parent activity in AndroidManifest.xml.		
		return super.onOptionsItemSelected(item);
	}
}
